<template>
	<view>
		<navbar  title="等级调整" :isGoBack="true" :isNotice="true" ></navbar>	
		<view class="all_shop">
			<view class="flex uni-form-item">
				 <span class="required">*</span>
				<view class="title">用户手机号</view>
				<input class="uni-input ml-30" v-model="username" focus placeholder="请输入用户手机号" />
			</view>
			<view class="flex">
				<button @click="!loading?formSubmit():''"><u-loading-icon color="#fff" size="16" style="margin-right: 5rpx;" :show="loading"></u-loading-icon> 提交</button>
			</view>		
			
		</view>
		
	</view>
</template>

<script>
	export default {
		data () {
			return {
				username:"",
				loading:false
			}			
		},
		onShow() {
		   
		},
		methods:{				
			formSubmit(){
				var username=this.username;
				 if(!username){
					uni.showToast({title:"请输入手机号！",icon:"none"})
					return
				 }
				this.loading=true
				this.$http.dolevelSend({
				  token:uni.getStorageSync('userInfo').app_openid,
				  login_type:'app',
				  phone:username
				}).then(res=>{
				   if(res.resCode=="9999"){		
					this.loading=false
					uni.showToast({title:res.resMessage,icon:"none"})					
					setTimeout(function () {
					  //要延时执行的代码
						uni.switchTab({
						  url: '/pages/mine/index',
						  success: function (e) {
							let pages = getCurrentPages()
							let currPage = pages[pages.length-2] //当前页面B页面实例
							currPage.$vm.refresh() //调用A页面的refresh方法
						  }
					   })
					}, 2500) //延迟时间			
				   }else{
					this.loading=false
					uni.showToast({title:res.resMessage,icon:"none"})
				   }
				})
			}
		},
	}
</script>

<style>
	.all_shop{
	    display: flex;
	    flex-direction: row;
	    flex-wrap: wrap;
	    background-color: #fff;
	   
	}
	.uni-form-item{
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		height: 90rpx;
		font-size: 30rpx;
		margin-left: 45rpx;		
	}
	
	button{
		display: flex;
		flex-direction: row;
		justify-content: center;
		color: white;
		border: none;
		width: 85%;
		padding: 5rpx 0rpx;
		position: absolute; /* 设置按钮为绝对定位 */
		bottom: 0; /* 距离底边为0 */
		left: 50%; /* 左侧距离父元素宽度的50% */
		transform: translateX(-50%); /* 向左移动自身宽度的50%，保持水平居中 */	
		background: #2b85e4;
		border-radius: 40rpx;
		font-size: 30rpx;
		margin-bottom: 25rpx;
	}
</style>